#!/usr/bin/env bash

set -o errexit

# 只是普通的赋值而已
hput() {
	eval "hhkey_$1"="$2"
}

hget() {
	eval echo '${'hhkey_$1'}'
}

hput k1 value1
hget k1
################################################

# 定义字典
declare -A dic
dic=([key1]="value1" [key2]="value2" [key3]="value3")
echo ${dic["key1"]}
#打印所有key
echo ${!dic[@]}
#打印所有value
echo ${dic[@]}
#打印所有value
echo ${dic[*]}

for key in ${!dic[@]}; do
	echo "$key : ${dic[$key]}"
done
